/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package sfs2x.extension.fourinarow.main;

import com.smartfoxserver.v2.core.ISFSEvent;
import com.smartfoxserver.v2.core.SFSEventParam;
import com.smartfoxserver.v2.entities.Room;
import com.smartfoxserver.v2.exceptions.SFSException;
import com.smartfoxserver.v2.extensions.BaseServerEventHandler;

/**
 *
 * @author dodinhchien
 */
public class RoomRemoveHandle extends BaseServerEventHandler{

    @Override
    public void handleServerEvent(ISFSEvent event) throws SFSException {
        Room room = (Room) event.getParameter(SFSEventParam.ROOM);
        if(room.isGame()){
            FourinarowExtension extension = (FourinarowExtension)getParentExtension();
            if(extension.getGamesList().contains(room.getId()))
                extension.getGamesList().remove(room.getId());
        }
    }
    
}
